package com.taobao.diamond;

import com.taobao.diamond.manager.DiamondManager;
import com.taobao.diamond.manager.ManagerListener;
import com.taobao.diamond.manager.impl.DefaultDiamondManager;

import java.util.concurrent.Executor;

/**
 * <p>@description: </p>
 *
 * @author yangshuang
 * @version 1.0
 * @date 2018/10/16 17:08
 */
public class TestCFG {

    public static void main(String[] args) {
        DiamondManager manager = new DefaultDiamondManager("DEFAULT_GROUP", "test",
                new ManagerListener() {//填写你服务端后台保存过的group和dataId
                    public void receiveConfigInfo(String configInfo) {
                        System.out.println("changed config: " + configInfo);
                    }

                    public Executor getExecutor() {
                        return null;
                    }
                }, "127.0.0.1,10.126.53.16,10.126.53.17");
        //设置diamond-server服务的端口
        manager.getDiamondConfigure().setPort(80);

        String availableConfigureInformation = manager.getAvailableConfigureInformation(5000);
        System.out.println("start config: " + availableConfigureInformation);
    }
}
